﻿using System;

namespace NEasy.Ldap.Attributes
{
    /// <summary>
    /// define a mapping between AD and class
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class LdapAttributeAttribute : Attribute
    {
        private readonly string _ldapAttributeName;

        public LdapAttributeAttribute(string ldapAttributeName)
        {
            _ldapAttributeName = ldapAttributeName;

            Create = true;
            Update = true;
        }

        /// <summary>
        /// returns the LDAP attribute
        /// </summary>
        public string LdapAttributeName
        {
            get { return _ldapAttributeName; }
        }

        /// <summary>
        /// defines if this attribute is the key for the ldap identity
        /// </summary>
        public bool IsPrimary { get; set; }

        /// <summary>
        /// defines if this property is used during account creation
        /// </summary>
        public bool Create { get; set; }

        /// <summary>
        /// defines if this property is used during account update
        /// </summary>
        public bool Update { get; set; }
    }
}